package network

import (
	k8sclient "k8s_gui_client/k8s/client"
)

//ingress list
func GetIngresses(namespace string) (map[string]interface{}, error) {
	//todo 不同版本的区别
	if namespace != "" {
		return k8sclient.CurrentK8sApiClient.GetAPI("/apis/extensions/v1beta1/namespaces/" + namespace + "/ingresses")
	} else {
		return k8sclient.CurrentK8sApiClient.GetAPI("/apis/extensions/v1beta1/ingresses")

	}

}

func IngressURL(namespace string,name string) string {
	return "/apis/extensions/v1beta1/namespaces/" + namespace + "/ingresses/"+name
}

func GetIngressYaml(namespace string,name string) (string ,error){
    return k8sclient.CurrentK8sApiClient.GetAPIAsYaml(IngressURL(namespace,name))
}